package 剑指offer;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zhangjunfei
 * @date 2023/8/7 9:48
 */
public class O_56_01 {

    public int[] singleNumbers(int[] nums) {
        int[] result = new int[2];
        Map<Integer, Integer> map = new HashMap<>();

        for (int i = 0; i < nums.length; i++) {
            map.put(nums[i], map.getOrDefault(nums[i], 0) + 1);
        }
        int index = 0;
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            if (entry.getValue() == 1) {
                result[index] = entry.getKey();
                index++;
            }
        }
        return result;
    }
}
